import javax.swing.tree.TreeNode;
import java.util.Enumeration;

public class Test {
    public static void main(String[] args) {
        BinarySearchTree b1=new BinarySearchTree();
        int [] arr=new int[]{3,1,5,2,7,0,8,9,4};
        for (int i = 0; i < arr.length; i++) {
            b1.insert(arr[i]);
        }
        b1.inorder(b1.root);
        System.out.println();
        try {
            BinarySearchTree.TreeNode flag=b1.search(5);
            if(flag==null){
                System.out.println("未找到");
            }else{
                System.out.println(flag.key);
            }
        }catch (EmptyTreeException e){
            e.getStackTrace();
        }
        try {
            b1.remove(5);
        }catch (EmptyTreeException e){
            e.getStackTrace();
        }
        b1.inorder(b1.root);
    }


}
